package ctrLag;
import modelLag.*;

/**
 * Write a description of class DvdCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DvdCtr {
    // instance variables - replace the example below with your own
    private DVDContainer dCon;
    private Copy copy;

    /**
     * Constructor for objects of class DvdCtr
     */
    public DvdCtr() {
        // initialise instance variables
        dCon = DVDContainer.getInstance();
    }

    /**
     * An example of a method - replace this comment with your own
     * 
     * @param  y   a sample parameter for a method
     * @return     the sum of x and y 
     */
    public void addDVD(int barcode, String title, String artist, String publicationDate) {
        DVD dvd = new DVD(barcode,title,artist,publicationDate);
        dCon.addDVD(dvd);
    }
    
    public DVD findDVD(int barcode) {
        DVD dvd = dCon.findDVD(barcode);
        return dvd;
    }
    
    public void deleteDVD(String title) {
        dCon.deleteDVD(title);
    }
    
    /*public void editDVD(int oldBarcode, int barcode, String title, String artist, String publicationDate)
    {
        DVD newDvd = new DVD(barcode,title,artist,publicationDate);
        dCon.updateDVD(oldBarcode, newDvd);
    }*/
    public void updateDVD(DVD dvd, int newBarcode, String newTitle, String newArtist, String newPublicationDate){
        dvd.setBarcode(newBarcode);
        dvd.setTitle(newTitle);
        dvd.setArtist(newArtist);
        dvd.setPublicationDate(newPublicationDate);
    }
    
    public void addCopy(DVD dvd, int serialNumber, String purchaseDate, double purchasePrice){
        Copy c = new Copy(serialNumber, purchaseDate,purchasePrice);
        dvd.addCopy(c);
    }
    
    public void deleteCopy(int barcode, int serialNumber){
        int i =0;
        DVD dvd = dCon.findDVD(barcode);
        
        
    }
    
    public Copy findCopy(DVD dvd, int serialNumber){
        Copy copy = dvd.findCopy(serialNumber);
        return copy;
    }
    
    public void printDVDList(){
        dCon.prinDvdList();
    }
}
